<?php
include_once '../init.php';
class UserTests {
	public static function login(){
		
		UserUtils::login("test", "test");
		
	}
	
	public static function addUser(){
		$u = new User();
		$u->setAddress("Addres");
		$u->setCity("Śrem");
		$u->setLogin("login");
		$u->setPassword("login");
		$u->setPhone("123456");
		$u->setSurname("Surname");
		$u->setName("Name");
		UserUtils::add($u);
		
		
		echo "role: "  . $u->getRole() . " id: " . $u->getId();
		return $u;
	}
	
	public static function removeUser(){
		
		$u = new User();
		$u->setId(1);
		
		if(UserUtils::remove($u)){
			echo "usunieto";
		}else{
			echo "nie usunieto";
		}
	}
	
	public static function changeRole(){
		$u = new User();
		$u->setId(4);
		UserUtils::setRole(UserRoles::SUPER_USER_ROLE, $u);
	}
	
	
	public static function modifyUser(){
		$u = new User();
		$u->setId(1);
		$u->setName("ModyfiName");		
		
		echo UserUtils::modify($u);
	}
	
	
	public static function find(){
		//TODO  po testach serwisow nalezy ponownie przetestowac zwracane wyniki		
		$usc = new UserSearchControls();
//		$usc->hasPaymentProblem(false);
		$usc->hasService(false);
		$usc->hasTicket(false);
		UserUtils::find($usc);
	}
		
	public static function get(){
		UserUtils::get(8);
		
	}
}


//UserTests::get();
//UserTests::login();
//UserTests::addUser();
//UserTests::removeUser();
//UserTests::modifyUser();
//UserTests::changeRole();
UserTests::find();
?>